package com.atguigu.srb.sms.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import javax.annotation.PostConstruct;

/**
 * ClassName: SMSProperties
 * Package: com.atguigu.srb.sms.properties
 * Description:
 *
 * @Author 刘强
 * @Create 2024/4/19 10:19
 * @Version 1.0
 */
@ConfigurationProperties(prefix = "aliyun.sms")   // 属性绑定 -> 绑定属性和配置文件中的配置项
@Data
public class SMSProperties   {
    String host = "";
    String path = "";
    String method = "";
    String appcode = "";

    public static String HOST = "";
    public static String PATH = "";
    public static String METHOD = "";
    public static String APPCODE = "";
    // 组件的定制化(自定义属性值)  --> 1. @PostConstruct  2. 实现InitializingBean接口
    //   都是在组件初始化完成后调用，我们就可以自定义属性值了
    @PostConstruct
    public void init(){
        HOST=host;
        PATH=path;
        METHOD=method;
        APPCODE=appcode;
    }

}
